/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2019-02-13 Time: 23:07
 */
import {RecordSummary} from "./Actions"
import {FetchStatus} from "../../../configuration/RequestConfiguration"

/**
 * 获取即时维修单状态
 * @param state
 * @param action
 * @returns {{fetchStatus: *}}
 */
export const onGetRecordSummary = (state = {}, action) => {
  switch (action.type) {
    case RecordSummary: {
      switch (action.status) {
        case FetchStatus.Start: {
          return {...state, fetchStatus: action.status}
        }
        case FetchStatus.Success: {
          return {...action.json, fetchStatus: action.status}
        }
        default: {
          return {...state, fetchStatus: action.status}
        }
      }
    }
  }
  return state
};

